package com.example.xiaomiao.Controller;

import com.example.xiaomiao.DTO.LoginRequestDTO;
import com.example.xiaomiao.DTO.RegisterRequestDTO;
import com.example.xiaomiao.DTO.Return;
import com.example.xiaomiao.Service.PublicService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/public")
public class PublicController {
    @Resource
    PublicService publicService;

    @PostMapping("/register")
    public Return register(@RequestBody RegisterRequestDTO registerRequestData){
        return publicService.register(registerRequestData);
    }

    @PostMapping("/login")
    public Return login(@RequestBody LoginRequestDTO loginRequestData){
        return publicService.login(loginRequestData);
    }
}
